<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;" lang="en">
<head>



  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">



  <meta name="Generator" content="Internet Assistant for Word Version 3.0">


  <title>First steps</title>
</head>


<body>



<h1 style="text-align: center;">COID  - First Steps</h1>

<div style="text-align: center;">WINDOWS

<br>

<br>

<div style="text-align: left;">
<h3>Installation</h3>


</div>

</div>

<dir>
<dir>
</dir>


</dir>



<ul>

  <li>Get the latest Windows and Linux version of coid from&nbsp;<a href="http://coid.sourceforge.net/">http://coid.sourceforge.net/</a></li>

</ul>

<ul>

  <li>Unpack the Linux archive to a fitting directory, e.g. c:\program files\coid\</li>

</ul>

<ul>

  <li>

Unpack the Windows archive to this directory and overwrite files if necessary</li>

</ul>

<br>

<h3>Compiling comm.lib</h3>


<dir>
<dir>
</dir>


</dir>



Before you start compiling a program, you have to build the comm
library. Therefore open the comm.dsw with Visual C++. Before you build
it, you have to check that under Project --&gt; comm Properties --&gt;
C/C++ --&gt; Code Generation the field 'Runtime Library ' is set to
Multi-Threaded DLL.<br>

Then you can build the release version of the project. Afterwards you
can find comm.lib in the Release\ folder. Copy it to coid\comm\ and the
installation is finished.<br>




<br>

<h3>Creating the server-side files </h3>


<dir>
<dir>
</dir>


</dir>



Let's assume you already have a header file (example.h), containing the
class you want to export (to export means to make it available as a
service on a coid server). It's important that this file contains only
one decorated (= meant to be exported) class. More about the decoration
of the header file with keywords in the <a href="example_program.html">example</a> document.<br>

<br>

At first you have to run coidgen. In case you want to compile your
server and client on different machines, just run coidgen once (on one
machine!) and distribute the generated files afterwards. Open the
console, change to your project directory and run (using the right coid
directory):<br>

<br>

&nbsp; &nbsp; <code>c:\program files\coid\bin\coidgen example.h</code><br>

<br>


This generates the whole communication layer for the client and server
from information found in that header, without modifying the class. <br>

The output of coidgen is a set of files for the client (the directory
'client' is created for it) and for the server (is placed in the same
directory as the service header). In our example it would generate
example_dispatch.h, Makefile, client/example_client.cpp and
client/example_client.h.<br>


<br>

First create a empty Visual C++ project for the server side. Add the
generated [service header file]_dispatch.cpp to your project, which is
the server source file (Project --&gt; Add existing Item --&gt;
_dispatch.cpp). <br>

Then go to the project properties (Project --&gt; Properties). In the
C/C++ -&gt; General section you have to enter the directory containing
the coid directory (e.g. C:\program files) in the Additional Include
Directory field.<br>

<br>


Furthermore you have to check if under C/C++ --&gt; Code Generation the field 'Runtime Library' is set to Multi-Threaded DLL.<br>

<br>

Then you have to make the linker settings. First enter the full path of
your coid/comm directory (e.g. c:\program files\coid\comm) into the
Linker --&gt; General --&gt; 'Additional Libraries Directories' field.<br>

Then modify the extension of Linker --&gt; General --&gt; 'Output' to
.dev. At last set Linker -&gt; Input -&gt; 'Additional Dependencies' to
comm.lib. Furthermore I had to set the Linker -&gt; Input -&gt; 'Ignore
Specific Library' field to LIBCMT.lib.<br>

<br>

Then you can build the release version of the project. Afterwards you
can find your device (.dev) in the Release\ folder. Copy it to
coid\bin\device in an appropriate subdirectory and the coid server will
be loading it when starting.<br>



Attention: Do not overwrite a currently used device! (Shut down server first)<br>

Once the coid server has been started and has loaded the device file,
the exported class can be called remotely from clients. Communication
takes place over network or in case the server and client are on the
same machine, coid uses interprocess communication.<br>

<br>



For more information about coidgen read&nbsp;<a href="http://coid.sourceforge.net/web/coidgen.html">http://coid.sourceforge.net/web/coidgen.html</a><br>




<br>

<h3>Creating the client-side files</h3>


<dir>
<dir>
</dir>


</dir>



Again create a empty Visual C++ project. As written above coidgen
creates the client directory and puts a [service header
file]_client.cpp and a [service header file]_client.h file in there,
e.g. example_client.cpp and example_client.h. Add these files to your
project (Project --&gt; Add existing Item). <br>

There has to be another source file (at least), which is calling the
provided methods. This file is naturally not generated, but has to be
written manually.<br>



Then you have to change the project properties in the exact same way as
above, except that the 'Runtime Library' is set to Multi-Threaded (not
a DLL).<br>

Now build your project and you get an .exe that you can run just like
any other program. Just the coid server has to run (but not necessarily
local).<br>




<br>

<h3>The COID server</h3>


<dir>
<dir>
</dir>


</dir>



To start the coid server you just have start coid.exe, which can be found in the coid\bin\ directory. <br>


In this case the server uses by default the port 55099, looks for the
device files in coid\bin\device and is starting all services found in
this files. <br>


If you want to change these defaults, you will have to create a .devconf configuration file in coid\bin.<br>



<br>

The .devconf file can contain these lines:<br>


<code>
'port' PORT<br>


'directory' NAME<br>


'default' ('all' | 'none')<br>


'service' NAME ('port' NUM)? ('dir' PATH)?<br>


'!service' NAME<br>

</code>
<br>


<code>port&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</code>That's the server port the client has to connect to.<br>


<code>directory&nbsp;&nbsp;</code>&nbsp;&nbsp;In this directory (and subdirectories) the server looks for .dev files.<br>


<code>default&nbsp;&nbsp; &nbsp;&nbsp;</code>all (load all services) / none (just load services listed with service)<br>


<code>!service&nbsp;&nbsp; &nbsp;</code>do not load service NAME<br>


<code>service&nbsp;&nbsp; &nbsp;&nbsp;</code>load service NAME, optionally using an
additional acceptor port (not coid acceptor port!) and working
directory (not device directory!)<br>

<br>

Once started, a 'tower' icon appears in the tray. Right click on it and
and choose 'Cmd console -all'. In the console windows that opens, enter
'root' as user name and no password. There you will see a listing which
services have been started. If your service (the name is your exported
class) is listed, everything went well and you can start your client.<br>




<br>

<h3>More services in one device</h3>


<dir>
<dir>
</dir>


</dir>



It is possible to link more than one service in a single device.
Therefore just run coidgen for every service header file. Add all
_dispatch.h files to your server project. <br>


On the client side also add all _client files to your client project.<br>



<br>

</body>
</html>
